<?php

namespace DP\Factory;

class ShapeFactory
{
    public function shape($shape)
    {
        if ($shape == null) {
            return null;
        }

        $shapeClass = '\\DP\\Factory\\Factories\\' . ucfirst(strtolower($shape)) . 'Shape';

        try {
            return new $shapeClass();
        } catch (\Exception $e) {
            echo $e->getMessage();
            return null;
        }
    }
}
